package org.agile2soft.nexoma.core.entities;

import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Embeddable;

@Embeddable
@SuppressWarnings({"serial"})
public class AccessId implements java.io.Serializable {

    private String profile;
    private String remoteLocate;
    private String remoteHost;
    private String remoteAddress;
    private Date outDate;
    private String userAgent;
    private Date date;

    public String toString () {
        return String.format("[AccessId %s,%s,%s,%s,%s,%s,%s]",profile,remoteLocate,remoteHost,remoteAddress,outDate,userAgent,date);
    }
    public AccessId() {
    }

    public AccessId(String accPerfil, String remoteLocate,
            String remoteHost, String remoteAddress, Date outDate,
            String userAgent, Date date) {
        this.profile = accPerfil;
        this.remoteLocate = remoteLocate;
        this.remoteHost = remoteHost;
        this.remoteAddress = remoteAddress;
        this.outDate = outDate;
        this.userAgent = userAgent;
        this.date = date;
    }

    @Column(name = "ACC_PROFILE", nullable = false, length = 100)
    public String getProfile() {
        return this.profile;
    }

    public void setProfile(String profile) {
        this.profile = profile;
    }

    @Column(name = "ACC_REMOTE_LOCATE", nullable = false, length = 2)
    public String getRemoteLocate() {
        return this.remoteLocate;
    }

    public void setRemoteLocate(String accRemoteLocate) {
        this.remoteLocate = accRemoteLocate;
    }

    @Column(name = "ACC_REMOTE_HOST", nullable = false, length = 150)
    public String getRemoteHost() {
        return this.remoteHost;
    }

    public void setRemoteHost(String remoteHost) {
        this.remoteHost = remoteHost;
    }

    @Column(name = "ACC_REMOTE_ADDRESS", nullable = false, length = 150)
    public String getRemoteAddress() {
        return this.remoteAddress;
    }

    public void setRemoteAddress(String remoteAddress) {
        this.remoteAddress = remoteAddress;
    }

    @Column(name = "ACC_OUT_DATE", nullable = false, length = 19)
    public Date getOutDate() {
        return this.outDate;
    }

    public void setOutDate(Date outDate) {
        this.outDate = outDate;
    }

    @Column(name = "ACC_USER_AGENT", nullable = false, length = 150)
    public String getUserAgent() {
        return this.userAgent;
    }

    public void setUserAgent(String userAgent) {
        this.userAgent = userAgent;
    }

    @Column(name = "ACC_DATE", nullable = false, length = 19)
    public Date getDate() {
        return this.date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public boolean equals(Object other) {
        if ((this == other))
            return true;
        if ((other == null))
            return false;
        if (!(other instanceof AccessId))
            return false;
        AccessId castOther = (AccessId) other;

        return ((this.getProfile() == castOther.getProfile()) || (this
                .getProfile() != null
                && castOther.getProfile() != null && this.getProfile()
                .equals(castOther.getProfile())))
                && ((this.getRemoteLocate() == castOther
                        .getRemoteLocate()) || (this.getRemoteLocate() != null
                        && castOther.getRemoteLocate() != null && this
                        .getRemoteLocate().equals(
                                castOther.getRemoteLocate())))
                && ((this.getRemoteHost() == castOther.getRemoteHost()) || (this
                        .getRemoteHost() != null
                        && castOther.getRemoteHost() != null && this
                        .getRemoteHost()
                        .equals(castOther.getRemoteHost())))
                && ((this.getRemoteAddress() == castOther
                        .getRemoteAddress()) || (this.getRemoteAddress() != null
                        && castOther.getRemoteAddress() != null && this
                        .getRemoteAddress().equals(
                                castOther.getRemoteAddress())))
                && ((this.getOutDate() == castOther.getOutDate()) || (this
                        .getOutDate() != null
                        && castOther.getOutDate() != null && this
                        .getOutDate().equals(
                                castOther.getOutDate())))
                && ((this.getUserAgent() == castOther.getUserAgent()) || (this
                        .getUserAgent() != null
                        && castOther.getUserAgent() != null && this
                        .getUserAgent().equals(castOther.getUserAgent())))
                && ((this.getDate() == castOther.getDate()) || (this
                        .getDate() != null
                        && castOther.getDate() != null && this
                        .getDate().equals(
                                castOther.getDate())));
    }

    public int hashCode() {
        int result = 17;

        result = 37 * result
                + (getProfile() == null ? 0 : this.getProfile().hashCode());
        result = 37
                * result
                + (getRemoteLocate() == null ? 0 : this.getRemoteLocate()
                        .hashCode());
        result = 37
                * result
                + (getRemoteHost() == null ? 0 : this.getRemoteHost()
                        .hashCode());
        result = 37
                * result
                + (getRemoteAddress() == null ? 0 : this
                        .getRemoteAddress().hashCode());
        result = 37
                * result
                + (getOutDate() == null ? 0 : this.getOutDate()
                        .hashCode());
        result = 37
                * result
                + (getUserAgent() == null ? 0 : this.getUserAgent()
                        .hashCode());
        result = 37
                * result
                + (getDate() == null ? 0 : this.getDate()
                        .hashCode());
        return result;
    }

}
